package com.pattern.demo.protogenesis;

/**
 * @ClassName: CurrentConditionsDisplay   当前时间风力、压力看板
 * @Description:
 * @Date: 2020/8/27 15:15
 * @Author: Song JinGen
 */
public class CurrentWindDisplay implements Observer, DisplayElement {
    private Subject weatherData;
    /**
     *  压力
     */
    private float pressure;

    /**
     * 风力
     */
    private String wind;

    private String msg;

    public CurrentWindDisplay(Subject weatherData){
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    /**
     * 天气展示看板
     */
    public void display() {
        System.out.println("当前风力压力情况：【 压力 ："+pressure+"F ；风力："+wind+"级 ; 详细信息："+msg+"】");
    }

    /**
     * 实时更新天气
     * @param temperature
     * @param humidity
     * @param pressure
     */
    public void update(float temperature, float humidity, float pressure, String wind, String msg) {
        this.pressure = pressure;
        this.wind = wind;
        this.msg = msg;
        display();
    }
}
